<%@ page language="java" import="java.util.*"  pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link href="../css/common.css" rel="stylesheet">
<link href="../css/index.css" rel="stylesheet">
<script src="../js/jquery-1.8.3.min.js"></script>
<link rel="stylesheet" href="../css/content.css" />
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=7bfcb05227f0f4324410e3b17fe3ea00"></script>
<style type="text/css">
	body, html {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";}
	#allmap {width: 68%;height: 95%;overflow: hidden;margin:20;font-family:"微软雅黑";}
</style>
<title>信息列表</title>

</head>

<body>
 <div class="fanhui">
    <p><a href="#">车辆监控&nbsp;</a></p><p>&gt;&nbsp;</p><p><a href="#">车辆监控&nbsp;</a></p><p>&gt;&nbsp;</p><p><a href="#">车辆动态&nbsp;</a></p>
 </div>
 <div id="allmap" class="ditu">123</div>
<div class="zonglan">
	
    <div class="xinxiliebiao">
    	<h5>信息列表</h5>
        <div class="cheliang">
        	<li id='list_1' ><p id='province_1'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_1'>--</p></li>
            <li id='list_2'><p id='province_2'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_2'>--</p></li>
            <li id='list_3'><p id='province_3'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_3'>--</p></li>
            <li id='list_4'><p id='province_4'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_4'>--</p></li>
            <li id='list_5'><p id='province_5'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_5'>--</p></li>
            <li id='list_6'><p id='province_6'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_6'>--</p></li>
            <li id='list_7'><p id='province_7'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_7'>--</p></li>
            <li id='list_8'><p id='province_8'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_8'>--</p></li>
            <li id='list_9'><p id='province_9'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_9'>--</p></li>
            <li id='list_10'><p id='province_10'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_10'>--</p></li>
            <li id='list_11'><p id='province_11'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_11'>--</p></li>
            <li id='list_12'><p id='province_12'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_12'>--</p></li>
            <li id='list_13'><p id='province_13'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_13'>--</p></li>
            <li id='list_14'><p id='province_14'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_14'>--</p></li>
            <li id='list_15'><p id='province_15'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_15'>--</p></li>
            <li id='list_16'><p id='province_16'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_16'>--</p></li>
            <li id='list_17'><p id='province_17'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_17'>--</p></li>
            <li id='list_18'><p id='province_18'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_18'>--</p></li>
            <li id='list_19'><p id='province_19'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_19'>--</p></li>
            <li id='list_20'><p id='province_20'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_20'>--</p></li>
            <li id='list_21'><p id='province_21'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_21'>--</p></li>
            <li id='list_22'><p id='province_22'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_22'>--</p></li>
            <li id='list_23'><p id='province_23'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_23'>--</p></li>
            <li id='list_24'><p id='province_24'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_24'>--</p></li>
            <li id='list_25'><p id='province_25'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_25'>--</p></li>
            <li id='list_26'><p id='province_26'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_26'>--</p></li>
            <li id='list_27'><p id='province_27'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_27'>--</p></li>
            <li id='list_28'><p id='province_28'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_28'>--</p></li>
            <li id='list_29'><p id='province_29'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_29'>--</p></li>
            <li id='list_30'><p id='province_30'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_30'>--</p></li>
            <li id='list_31'><p id='province_31'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_31'>--</p></li>
            <li id='list_32'><p id='province_32'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_32'>--</p></li>
            <li id='list_33'><p id='province_33'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_33'>--</p></li>
            <li id='list_34'><p id='province_34'>--</p><img src="../images/chelianglieb-heng.png"><p id='num_34'>--</p></li>       
        </div>
        <div class="tab" style="display:none;">
        	<div class="subnav">
            	<li tt="teb01" class="active">整车数据</li>
                <li tt="teb02">电机数据</li>
                <li tt="teb03">燃料电池</li>
                <li tt="teb04">极值数据</li>
                <li tt="teb05" style="margin-right:0px; width:20%;">报警数据</li>
            </div>
            <div class="all" >
                <div class="subnav-neirong teb01">
                    <li>车辆状态：<span id='vehicle_status'>--</span></li> 
                    <li>充电状态：<span id='charging_status'>--</span></li>
                    <li>运行模式：<span id='work_status'>--</span></li> 
                    <li>车速：<span id='vehicle_speed'>--</span>KM/H</li> 
                    <li>累积里程：<span id='total_mileage'>--</span>KM</li> 
                    <li>总电压：<span id='total_vol'>--</span>V</li>  
                    <li>总电流：<span id='total_cur'>--</span>A</li>
                    <li>SOC：<span id='soc'>--</span>%</li>
                    <li>DC-DC 状态：<span id='dc_dc_status'>--</span></li>
                    <li>档位：<span id='vehicle_gear'>--</span></li>
                    <li>加速踏板行程值：<span id='acc_pedal_stroke'>--</span>%</li>
                    <li>制动踏板状态：<span id='brake_pedal_status'>--</span></li>
                    <li>绝缘电阻值：<span id='insulation_values'>--</span>kΩ</li>
                </div>
                 <div class="subnav-neirong teb02" style="display:none;">
                    <li>驱动电机个数：<span id='motor_total_number'>--</span>个</li> 
                    <li>驱动电机序号：<span id='motor_serial_index'>--</span></li>
                    <li>驱动电机状态：<span id='motor_status'>--</span></li> 
                    <li>电机控制器输入电压：<span id='motor_vol'>--</span>V</li> 
                    <li>电机控制器母线电流：<span id='motor_cur'>--</span>A</li>  
                    <li>驱动电机控制器温度：<span id='motor_control_temp'>--</span>°C</li> 
                    <li>驱动电机温度：<span id='motor_temp'>--</span>°C</li> 
                    <li>驱动电机转速：<span id='motor_speed'>--</span>rpm</li> 
                    <li>驱动电机转矩：<span id='motor_nm'>--</span>NM</li>  
                </div>
                 <div class="subnav-neirong teb03" style="display:none;">
                    <li>燃料电池电压：<span >--</span>V</li> 
                    <li>燃料电池电流：<span >--</span>A</li> 
                    <li>燃料消耗率：<span >--</span>Km</li> 
                    <li>燃料电池温度探针总数：<span >--</span>个</li> 
                    <li>探针温度值：<span >--</span>°C</li> 
                    <li>氢系统中最高温度：<span >--</span>°C</li> 
                    <li>氢系统中最高温度探针代号：<span >--</span></li> 
                    <li>氢气最高浓度：<span >--</span>mg/Kg</li> 
                    <li>氢气最高浓度传感器代号：<span >--</span>号</li> 
                    <li>氢气最高压力：<span >--</span>MPa</li> 
                    <li>氢气最高压力传感器代号：<span >--</span></li> 
                    <li>高压 DC-DC 状态：工作</li> 
                    <li>发动机状态：启动</li> 
                    <li>曲轴转速：<span >--</span>rpm</li> 
                    <li>燃料消耗率：<span >--</span>Kg/100Km</li> 
                </div>
                <div class="subnav-neirong teb04" style="display:none;">
                    <li>最高电压电池子系统号：<span id='batpage_max_vol_number'>--</span>号</li> 
                    <li>最高电压电池单体代号：<span id='bat_single_max_vol_number'>--</span>号</li> 
                    <li>电池单体电压最高值：<span id='bat_single_max_vol'>--</span>V</li> 
                    <li>最低电压电池子系统号：<span id='batpage_min_vol_number'>--</span>号</li> 
                    <li>最低电压电池单体代号：<span id='bat_single_min_vol_number'>--</span>号</li> 
                    <li>电池单体电压最低值：<span id='bat_single_min_vol'>--</span>V</li> 
                    <li>最高温度子系统号：<span id='batpage_max_temp_number'>--</span> 号</li> 
                    <li>最高温度探针代号：<span id='bat_single_max_temp_number'>--</span> 号</li> 
                    <li>最高温度值：<span id='bat_single_max_temp'>--</span>°C</li> 
                    <li>最低温度子系统号：<span id='batpage_min_temp_number'>--</span> 号</li> 
                    <li>最低温度探针代号：<span id='bat_single_min_temp_number'>--</span> 号</li> 
                    <li>最低温度值：<span id='bat_single_min_temp'>--</span>°C</li> 
                    <li></li> 
                    <li></li> 
                    <li></li> 
                </div>
                <div class="subnav-neirong teb05" style="display:none;">
                    <li>最高报警等级：3 级</li> 
                    <li>报警描述：SOC过低</li> 
                    <li>最高报警等级：2 级</li> 
                    <li>报警描述：刹车踏板故障</li> 
                </div>
            </div>
        </div>
    </div>
</div>
<!--查询弹框开始-->
<div class="showbox">
		<div class="shang"><p><span id="show_vin">--</span><span>（所属单位：奇瑞汽车股份有限公司）</span></p><a class="close" href="#"><img src="../images/cha.png"></a></div>
		<div class="mainlist">
			<ul>
            	<li>车辆状态：<span id="show_vehicle_status">--</span></li>
                <li>模式：<span id="show_work_status">--</span></li>
                <li>注册时间：<span id="show_register_date">--</span></li>
            </ul>
            <ul>
            	<li>定位状态：<span id="show_position_status">--</span></li>
                <li>方向：<span id="show_direction">--</span></li>
                <li>数据时间：<span id="show_sensor_time">--</span></li>
            </ul>
            <ul>
            	<li style="margin-right:25px;">GPS车速：<span id="show_speed">--</span>KM/h</li>
                <li>位置：<span id="show_location">--</span></li>
            </ul>
            <ul>
            	<li style="margin-right:10px;"><a href="vehicle_Info.jsp">静态信息</a></li>
                <li style="margin-right:10px;"><a href="vehicle_Trace.jsp">车辆跟踪</a></li>
                <li style="margin-right:10px;"><a href="vehicle_PlayBack.jsp">轨迹回放</a></li>
                <li style="margin-right:10px;"><a href="vehicle_Data.jsp?vehicleid=1">实时数据</a></li>
            </ul>
		</div>
	</div>	
<script type="text/javascript">
$(document).ready(function(){
	$("#tan").click(function(){
		var box =300;
		var th= $(window).scrollTop()+$(window).height()/1.6-box;
		var h =document.body.clientHeight;
		var rw =$(window).width()/2-box;
		$(".showbox").animate({top:th,opacity:'show',width:585,height:280,right:rw},500);
		$("#zhezhao").css({
			display:"block",height:$(document).height()
		});
		return false;
	});
	$(".showbox .close").click(function(){
		$(this).parents(".showbox").animate({top:0,opacity: 'hide',width:0,height:0,right:0},500);
		$("#zhezhao").css("display","none");
		$(".tab").hide();
		$(".cheliang").show();
	});
	$(document).ready(function(e) {
			$(".subnav li").click(function(){
				$(this).addClass("active").siblings().removeClass("active");
				var tt=$(this).attr("tt");
				$(this).parents(".subnav").siblings(".all").children("."+tt).show().siblings().hide();
				
			});
		});
	//地图车辆数量显示及右侧列表车辆数量----按省份
	$(document).ready(function(){
		//$("#allmap").load("map.jsp");
		for(var i=1;i<=34;i++){
			$("#list_"+i).hide();
		}
		$.ajax({
			async: false,
			type : "post",
			url: "<%=basePath%>vehicle/selectProvinceVehicleByUser.do",
			datatype: "json",
			success : function(data){
				var list = eval("("+data+")");
				for(var i=1;i<=list.length;i++){
					$("#list_"+i).show();
					$("#province_"+i).html(list[i-1].province);
					$("#num_"+i).html(list[i-1].vehicle_num);
				}
			 },
	         error: function (XMLHttpRequest, textStatus, errorThrown) {
				
	         }
	     });
	});
});
</script>
<!--查询弹框结束-->
	<script type="text/javascript">
		var map = new BMap.Map("allmap");    // 创建Map实例,{mapType: BMAP_HYBRID_MAP}
		map.centerAndZoom(new BMap.Point(116.4100451627,39.916976551955), 5);  // 初始化地图,设置中心点坐标和地图级别
		map.addControl(new BMap.MapTypeControl());   //添加地图类型控件
		map.enableScrollWheelZoom(true); 
		var geoc = new BMap.Geocoder();//地理位置转码工具
		var mapzoomlevel=5;//地图缩放等级     5-7省级  8-9市级   10-n车辆坐标
		var oldvid = null;
		var oldprovince=null;
		var oldcity=null;
		var list_static=null;
		map.addEventListener("zoomend", function(){  
			mapzoomlevel=this.getZoom();
			if(mapzoomlevel<8){
				 oldvid = null;
				 oldcity=null;
			}
			if(mapzoomlevel>7&&mapzoomlevel<10){
				 oldvid = null;
				 oldprovince=null;
			}
			if(mapzoomlevel>9){
				 oldprovince=null;
				 oldcity=null;
			}
			addMarkers(list_static);
		});
	
	var data_info=new Array();
		 SelectGps();
		// setInterval(function(){
		//	 var display =$(".BMap_pop").css("display"); 
		//	 if(display=="none"){
		//			 oldvid = null;
		//			 oldprovince=null;
		//			 oldcity=null;
		//	 }
		//}, 500);  
		 setInterval(function(){
			SelectGps();
		}, 30000);  
	//查询车辆位置
	function SelectGps(){
		var uri="<%=basePath%>vehicle/selectVehicleLocationByUser.do";
		$.ajax({
			async: true,
			type : "GET",
			url : uri,
			datatype: "json",
			success : function(data){
					var list = eval("(" + data + ")");
					list_static=list;
					addMarkers(list);
				}
			});
	}
	//查询整车数据 并填充
	function initShowBox(vid){
		var box =300;
		var th= $(window).scrollTop()+$(window).height()/1.6-box;
		var h =document.body.clientHeight;
		var rw =$(window).width()/2-box+200;
		$(".showbox").animate({top:th,opacity:'show',width:585,height:280,right:rw},500);
		$("#zhezhao").css({
			display:"block",height:$(document).height()
		});
		$(".tab").show();
		$(".cheliang").hide();
		var uri="<%=basePath%>vehicle/selectAllByOne.do?vehicleid="+vid;
		$.ajax({
			async: true,
			type : "get",
			url : uri,
			datatype: "json",
			success : function(data){
				var list = eval("(" + data + ")");
				//填充内容
				if(list[0].position_status%2==1){
					$("#show_position_status").html("无效");
				}else{
					$("#show_position_status").html("有效");
				}
				if(list[0].direction<=22.5||list[0].direction>=337.5){
					$("#show_direction").html("北");
				}else if(list[0].direction>22.5&&list[0].direction<=67.5){
					$("#show_direction").html("东北");
				}else if(list[0].direction>67.5&&list[0].direction<=112.5){
					$("#show_direction").html("东");
				}else if(list[0].direction>112.5&&list[0].direction<=157.5){
					$("#show_direction").html("东南");
				}else if(list[0].direction>157.5&&list[0].direction<=202.5){
					$("#show_direction").html("南");
				}else if(list[0].direction>202.5&&list[0].direction<=247.5){
					$("#show_direction").html("西南");
				}else if(list[0].direction>247.5&&list[0].direction<=292.5){
					$("#show_direction").html("西");
				}else if(list[0].direction>292.5&&list[0].direction<=337.5){
					$("#show_direction").html("西北");
				}
				$("#show_sensor_time").html(list[0].sensor_time);
				$("#show_speed").html(list[0].speed);
				//根据经纬度计算地理位置
				var point = new BMap.Point(list[0].longitude,list[0].latitude);
				var location="无效";
				geoc.getLocation(point, function(rs){
					var addComp = rs.addressComponents;
					location=addComp.province + " " + addComp.city + " " + addComp.district + " " 
					+ addComp.street + " " + addComp.streetNumber;
					}); 
				$("#show_location").html(location);
				//整车数据
				if(list[0].vehicle_status==1){
					$("#show_vehicle_status").html("启动");
					$("#vehicle_status").html("启动");
				}else if(list[0].vehicle_status==2){
					$("#show_vehicle_status").html("熄火");
					$("#vehicle_status").html("熄火");
				}else{
					$("#show_vehicle_status").html("其他");
					$("#vehicle_status").html("其他");
				}
				if(list[0].work_status==1){
					$("#show_work_status").html("纯电");
					$("#work_status").html("纯电");
				}else if(list[0].work_status==2){
					$("#show_work_status").html("混动");
					$("#work_status").html("混动");
				}else if(list[0].work_status==3){
					$("#show_work_status").html("燃油");
					$("#work_status").html("燃油");
				}else{
					$("#show_work_status").html("无效");
					$("#work_status").html("无效");
				}
				if(list[0].charging_status==1){
					$("#charging_status").html("停车充电");
				}else if(list[0].charging_status==2){
					$("#charging_status").html("行驶充电");
				}else if(list[0].charging_status==3){
					$("#charging_status").html("未充电");
				}else if(list[0].charging_status==4){
					$("#charging_status").html("充电完成");
				}else{
					$("#charging_status").html("无效");
				}
				$("#vehicle_speed").html(list[0].vehicle_speed);
				$("#totale_mileage").html(list[0].totale_mileage);
				$("#total_vol").html(list[0].total_vol);
				$("#total_cur").html(list[0].total_cur);
				$("#soc").html(list[0].soc);
				if(list[0].dc_dc_status==1){
					$("#dc_dc_status").html("工作");
				}else if(list[0].dc_dc_status==1){
					$("#dc_dc_status").html("断开");
				}else{
					$("#dc_dc_status").html("无效");
				}
				if(list[0].vehicle_gear%16==0){
					$("#vehicle_gear").html("空挡");
				}else if(list[0].vehicle_gear%16==1){
					$("#vehicle_gear").html("1挡");
				}else if(list[0].vehicle_gear%16==2){
					$("#vehicle_gear").html("2挡");
				}else if(list[0].vehicle_gear%16==3){
					$("#vehicle_gear").html("3挡");
				}else if(list[0].vehicle_gear%16==4){
					$("#vehicle_gear").html("4挡");
				}else if(list[0].vehicle_gear%16==5){
					$("#vehicle_gear").html("5挡");
				}else if(list[0].vehicle_gear%16==6){
					$("#vehicle_gear").html("6挡");
				}else if(list[0].vehicle_gear%16==13){
					$("#vehicle_gear").html("R挡");
				}else if(list[0].vehicle_gear%16==14){
					$("#vehicle_gear").html("D挡");
				}else if(list[0].vehicle_gear%16==15){
					$("#vehicle_gear").html("P挡");
				}else{
					$("#vehicle_gear").html("无效");
				}
				$("#vehicle_gear").html(list[0].acc_pedal_stroke);
				if(list[0].brake_pedal_status==0){
					$("#brake_pedal_status").html("未制动");
				}else if(list[0].brake_pedal_status>=1&&list[0].brake_pedal_status<=100){
					$("#brake_pedal_status").html(list[0].brake_pedal_status+"%");
				}else if(list[0].brake_pedal_status==101){
					$("#brake_pedal_status").html("制动");
				}else{
					$("#brake_pedal_status").html("无效");
				}
				$("#insulation_values").html(list[0].insulation_values);
				//驱动电机数据
				$("#motor_total_number").html(list[0].motor_total_number);
				$("#motor_serial_index").html(list[0].motor_serial_index);
				if(list[0].motor_status==1){
					$("#motor_status").html("耗电");
				}else if(list[0].motor_status==1){
					$("#motor_status").html("发电");
				}else if(list[0].motor_status==1){
					$("#motor_status").html("关闭");
				}else if(list[0].motor_status==1){
					$("#motor_status").html("准备");
				}else {
					$("#motor_status").html("无效");
				}
				$("#motor_vol").html(list[0].motor_vol);
				$("#motor_cur").html(list[0].motor_cur);
				$("#motor_control_temp").html(list[0].motor_control_temp);
				$("#motor_temp").html(list[0].motor_temp);
				$("#motor_speed").html(list[0].motor_speed);
				$("#motor_nm").html(list[0].motor_nm);
               	//电池数据
               	$("#batpage_max_vol_number").html(list[0].batpage_max_vol_number);
               	$("#bat_single_max_vol_number").html(list[0].bat_single_max_vol_number);
               	$("#bat_single_max_vol").html(list[0].bat_single_max_vol);
               	$("#batpage_min_vol_number").html(list[0].batpage_min_vol_number);
               	$("#bat_single_min_vol_number").html(list[0].bat_single_min_vol_number);
               	$("#bat_single_min_vol").html(list[0].bat_single_min_vol);
               	$("#batpage_max_temp_number").html(list[0].motorbatpage_max_temp_number_nm);
               	$("#bat_single_max_temp_number").html(list[0].bat_single_max_temp_number);
               	$("#bat_single_max_temp").html(list[0].bat_single_max_temp);
               	$("#batpage_min_temp_number").html(list[0].batpage_min_temp_number);
               	$("#bat_single_min_temp_number").html(list[0].bat_single_min_temp_number);
               	$("#bat_single_min_temp").html(list[0].bat_single_min_temp);				
			}
		});
	}
	function addMarkers(list){
		map.clearOverlays(); 
		data_info=new Array();
		if(mapzoomlevel<8){//5-7省级
			for(var i=0;i<list.length;i++){
				if(list[i].plong!=null&&list[i].plat!=null&&list[i].plong!=0&&list[i].plat!=0){
					var lng = list[i].plong;
					var lat = list[i].plat;
					var zlzs=0;
					var zxcl=0;
					var lxcl=0;
					var gzcl=0;
					var clst = list[i].clst;
					for(var c=0;c<clst.length;c++){
						var vlst = clst[c].vlst;
						for(var v=0;v<vlst.length;v++){
							zlzs++;
							if(vlst[v].state==1){
								zxcl++;
							}
							if(vlst[v].state==2){
								lxcl++;
							}
							if(vlst[v].state==3){
								gzcl++;
							}
						}
					}
					var arrpoin = new Array();
					arrpoin.push(lng);
					arrpoin.push(lat);  
					arrpoin.push("<span style='font-size:12px'><b>车辆总数</b>："+zlzs+"<br/><b>在线车辆</b>："+zxcl+"<br/><b>离线车辆</b>："+lxcl+"<br/>"+
					"<b>故障车辆</b>："+gzcl+"</span><span style='float: right;font-size:12px'><a href='javascript:UpdateZoom(8)'>展开</a></span>");  
					arrpoin.push(list[i].province);
					arrpoin.push(zlzs);
					data_info.push(arrpoin);
				}
			}
			for(var i=0;i<data_info.length;i++){
				var pt = new BMap.Point(data_info[i][0], data_info[i][1]);
				var myIcon = new BMap.Icon("images/province.png", new BMap.Size(79,34), {anchor: new BMap.Size(0, 30)});      
				var marker = new BMap.Marker(pt,{icon:myIcon});  // 创建标注
				map.addOverlay(marker);      
				var content = data_info[i][2];
				var title = data_info[i][3];
				var zlzs =  data_info[i][4];
				var label = new BMap.Label(title+"&nbsp;&nbsp;"+zlzs,{offset:new BMap.Size(10,3)});
				label.setStyle({
			        "border": "0",
			        "background": "transparent",
			        "color": "#FFF",
			        "font-weight": "bold"
			      }); 
				marker.setLabel(label);
				addProvinceClickHandler(title,content,marker);
				if(title==oldprovince){
					openInfoProvinceOld(title,content,data_info[i][0],data_info[i][1]);
				}
			}
		}
		if(mapzoomlevel>7&&mapzoomlevel<10){//8-9市级 
			for(var i=0;i<list.length;i++){
				var clst = list[i].clst;
				for(var c=0;c<clst.length;c++){
					var vlst = clst[c].vlst;
					var lng = clst[c].clong;
					var lat = clst[c].clat;
					var zlzs=0;
					var zxcl=0;
					var lxcl=0;
					var gzcl=0;
					for(var v=0;v<vlst.length;v++){
						zlzs++;
						if(vlst[v].state==1){
							zxcl++;
						}
						if(vlst[v].state==2){
							lxcl++;
						}
						if(vlst[v].state==3){
							gzcl++;
						}
					}
					var arrpoin = new Array();
					arrpoin.push(lng);
					arrpoin.push(lat);  
					arrpoin.push("<span style='font-size:12px'><b>车辆总数</b>："+zlzs+"<br/><b>在线车辆</b>："+zxcl+"<br/><b>离线车辆</b>："+lxcl+"<br/>"+
					"<b>故障车辆</b>："+gzcl+"</span><span style='float: right;font-size:12px'><a href='javascript:UpdateZoom(10)'>展开</a></span>");  
					arrpoin.push(clst[c].city);
					arrpoin.push(zlzs);
					data_info.push(arrpoin);
				}
			}
			for(var i=0;i<data_info.length;i++){
				var pt = new BMap.Point(data_info[i][0], data_info[i][1]);
				var myIcon = new BMap.Icon("images/province_2.png", new BMap.Size(79,34), {anchor: new BMap.Size(0, 30)});      
				var marker = new BMap.Marker(pt,{icon:myIcon});  // 创建标注
				map.addOverlay(marker);      
				var content = data_info[i][2];
				var title = data_info[i][3];
				var zlzs =  data_info[i][4];
				var label = new BMap.Label(title+"&nbsp;&nbsp;"+zlzs,{offset:new BMap.Size(10,3)});
				label.setStyle({
			        "border": "0",
			        "background": "transparent",
			        "color": "#FFF",
			        "font-weight": "bold"
			      }); 
				marker.setLabel(label);
				addCityClickHandler(title,content,marker);
				if(title==oldcity){
					openInfoCityOld(title,content,data_info[i][0],data_info[i][1]);
				}
			}
		}
		if(mapzoomlevel>9){//11-n车辆坐标
			for(var p=0;p<list.length;p++){
				var clst = list[p].clst;
				for(var c=0;c<clst.length;c++){
					var vlst = clst[c].vlst;
					for(var i=0;i<vlst.length;i++){
						if(vlst[i].longitude!=null&&vlst[i].latitude!=null&&vlst[i].longitude!=0&&vlst[i].latitude!=0){
							var lng = vlst[i].longitude;
							var lat = vlst[i].latitude;
							var icontype="green";
							var state="<span class=\"run\">启动</span>";
							if(vlst[i].vehicle_status==1){
								icontype="green";
								state="<span class=\"run\">启动</span>";
							}else if(vlst[i].vehicle_status==2){
								icontype="gray";
								state="<span class=\"off\">熄火</span>";
							}else if(vlst[i].warning_flag>0){
								icontype="orange";
								state="<span class=\"warning\">故障</span>";
							}else{
								icontype="gray";
								state="<span class=\"off\">无效</span>";
							}
							if(vlst[i].vehicleid==oldvid){
								icontype="blue";
							}
							var arrpoin = new Array();
							arrpoin.push(lng);
							arrpoin.push(lat);  
							arrpoin.push("<span style='font-size:12px'><b>VIN</b>："+vlst[i].vin+"<br/><b>数据时间</b>："+vlst[i].lastdate+"<br/><b>运行状态</b>："+state+"<br/>"+
							"<b>经度</b>："+lng+"<br/><b>纬度</b>："+lat+"</span><a style=\"float: right;\" class=\"mini-button mini-button-plain\" href=\"javascript:OpenSearch("+vlst[i].vehicleid+")\"><span class=\"mini-button-text  mini-button-icon icon-search\" >查看详情</span></a>");  
							arrpoin.push(icontype);
							arrpoin.push(vlst[i].vehicle_name);
							arrpoin.push(vlst[i].vehicleid);
							data_info.push(arrpoin);
						}
					}
				}
			}
			for(var i=0;i<data_info.length;i++){
				var pt = new BMap.Point(data_info[i][0], data_info[i][1]);
				var myIcon = new BMap.Icon( "images/mach_marker_"+data_info[i][3]+".png", new BMap.Size(36,37));
				var marker = new BMap.Marker(pt,{icon:myIcon});  // 创建标注
				map.addOverlay(marker);      
				var content = data_info[i][2];
				var title = data_info[i][4];
				var vid = data_info[i][5];
				addClickHandler(vid,title,content,marker);
				//if(vid==oldvid){
				//	openInfoOld(vid,title,content,data_info[i][0],data_info[i][1]);
				//}
			}
		}
	}
	function addClickHandler(vid,title,content,marker){
		marker.addEventListener("click",function(e){
			initShowBox(vid);
			//openInfo(vid,title,content,e);
			//SelectGps();
			}
		);
	}
	function addProvinceClickHandler(title,content,marker){
		marker.addEventListener("click",function(e){
			openProvinceInfo(title,content,e);
			//SelectGps();
			}
		);
		marker.addEventListener("dblclick",function(e){
			UpdateZoom(8);
			}
		);
	}
	function addCityClickHandler(title,content,marker){
		marker.addEventListener("click",function(e){
			openCityInfo(title,content,e);
			//SelectGps();
			}
		);
		marker.addEventListener("dblclick",function(e){
			UpdateZoom(10);
			}
		);
	}
	function openCityInfo(title,content,e){
		oldcity=title;
		var p = e.target;
		var point = new BMap.Point(p.getPosition().lng, p.getPosition().lat);
		var opts = {
				width : 90,     // 信息窗口宽度
				height: 0,     // 信息窗口高度
				title : "<b>"+title+"</b>" , // 信息窗口标题
				enableMessage:false,//设置允许信息窗发送短息
				offset: new BMap.Size(34, -20)
		};
		var infoWindow = new BMap.InfoWindow(content,opts);  // 创建信息窗口对象 
		map.openInfoWindow(infoWindow,point); //开启信息窗口
	}
	function openProvinceInfo(title,content,e){
		oldprovince=title;
		var p = e.target;
		var point = new BMap.Point(p.getPosition().lng, p.getPosition().lat);
		var opts = {
				width : 90,     // 信息窗口宽度
				height: 0,     // 信息窗口高度
				title : "<b>"+title+"</b>" , // 信息窗口标题
				enableMessage:false,//设置允许信息窗发送短息
				offset: new BMap.Size(34, -20)
		};
		var infoWindow = new BMap.InfoWindow(content,opts);  // 创建信息窗口对象 
		map.openInfoWindow(infoWindow,point); //开启信息窗口
	}
	function openInfo(vid,title,content,e){
		oldvid=vid;
		var p = e.target;
		var point = new BMap.Point(p.getPosition().lng, p.getPosition().lat);
		var opts = {
				width : 250,     // 信息窗口宽度
				height: 0,     // 信息窗口高度
				title : "<b>"+title+"</b>" , // 信息窗口标题
				enableMessage:false//设置允许信息窗发送短息
		};
		var infoWindow = new BMap.InfoWindow(content,opts);  // 创建信息窗口对象 
		map.openInfoWindow(infoWindow,point); //开启信息窗口
	}
	function openInfoOld(vid,title,content,lng,lat){
		oldvid=vid;
		var point = new BMap.Point(lng,lat);
		var opts = {
				width : 250,     // 信息窗口宽度
				height: 0,     // 信息窗口高度
				title : "<b>"+title+"</b>" , // 信息窗口标题
				enableMessage:false//设置允许信息窗发送短息
		};
		var infoWindow = new BMap.InfoWindow(content,opts);  // 创建信息窗口对象 
		map.openInfoWindow(infoWindow,point); //开启信息窗口
	}
	function openInfoProvinceOld(title,content,lng,lat){
		oldprovince=title;
		var point = new BMap.Point(lng,lat);
		var opts = {
				width : 90,     // 信息窗口宽度
				height: 0,     // 信息窗口高度
				title : "<b>"+title+"</b>" , // 信息窗口标题
				enableMessage:false,//设置允许信息窗发送短息
				offset: new BMap.Size(34, -20)
		};
		var infoWindow = new BMap.InfoWindow(content,opts);  // 创建信息窗口对象 
		map.openInfoWindow(infoWindow,point); //开启信息窗口
	}
	function openInfoCityOld(title,content,lng,lat){
		oldcity=title;
		var point = new BMap.Point(lng,lat);
		var opts = {
				width : 90,     // 信息窗口宽度
				height: 0,     // 信息窗口高度
				title : "<b>"+title+"</b>" , // 信息窗口标题
				enableMessage:false,//设置允许信息窗发送短息
				offset: new BMap.Size(34, -20)
		};
		var infoWindow = new BMap.InfoWindow(content,opts);  // 创建信息窗口对象 
		map.openInfoWindow(infoWindow,point); //开启信息窗口
	}
	function UpdateZoom(level){
		map.setZoom(level);  
	}
	function OpenSearch(vehicleid){
		mini.open({                
	        url: "jsp/Vehicle_monitoring/Windows_vehicle_info.jsp?vehicleid="+vehicleid,    
	        showMaxButton: true,
	        title: "车辆实时监控信息",
	        width: "90%",
	        height: 620,
	        ondestroy: function (action) {  
	            /* if (action == "ok") {
	            } */
	        }
	    }); 
	}
	</script>
</body>
</html>